from multiprocessing.pool import ThreadPool
import myserver
import socket


class ThreadServer(myserver.Server):
    """docstring for ThreadServer"""
    def __init__(self,):
        super(ThreadServer, self).__init__()


    def main(self,conn,addr) :
        self.new_member(conn,addr)
        while True:
            if not self.communicateWith(conn) :
                break


if __name__ == '__main__':
    server=ThreadServer()
    #可以指定数量线程供用户调用
    pool=ThreadPool(4)
    while True :
        conn,addr=server.listenfd.accept()
        pool.apply_async(server.main,args=(conn,addr,))

